
<% if admin? %>

<h1>Sign up new Cartasur user</h1>
<%  unless @user.nil?
      @user.password = nil
      @user.password_confirmation = nil
    end
%>

<%= error_messages_for :user %>
<% if flash[:error] %>
    <div class="flash error"><p><%= flash[:error] %></p></div>
<% end %>


<%= form_for  @user, :url => { :action => "create" } do |f| %>
    <table cellpadding="5" cellspacing="10">
      <th align="center">All fields are required. </th>
      <tr>
        <td align="right"><%= f.label :login, 'Username:', :class => 'form_text_field_label'%></td>
        <td><%= f.text_field :login, :class => 'form_text_field' %></td>
      </tr>
      <tr>
        <td align="right"><%= f.label :password, 'Password: <br/><font style="font-size:10px"> (no symbols or spaces please!)</font>'.html_safe, :class=> 'form_text_field_label' %></td>
        <td><%= f.password_field :password, :class=>'form_text_field' %></td>
      </tr>
      <tr>
        <td align="right"><%= label_tag :password_confirmation, '<b>Repeat password:</b>'.html_safe, :class=> 'form_text_field_label' %></td>
        <td><%= f.password_field :password_confirmation, :class => 'form_text_field' %></td>
      </tr>
      <tr>
        <td align="right"><%= label_tag :email, 'E-mail address:',:class=> 'form_text_field_label' %></td>
        <td><%= f.text_field :email, :class=> 'form_text_field'%></td>
      </tr>
      <tr>
        <td align="right"><%= label_tag :location, 'Home town: <br/><font style="font-size:10px"> (please write City, Country)</font>'.html_safe, :class=> 'form_text_field_label' %></td>
        <td><%= f.text_field :location, :class=> 'form_text_field' %></td>
      </tr>
      <tr>
        <td align="right"><%= label_tag :phonemodel, 'Mobile phone brand & model:', :class=> 'form_text_field_label' %></td>
        <td><%= f.text_field :phonemodel, :class=> 'form_text_field' %></td>
      </tr>
      <tr>
        <td align="right"><%= f.label :role, 'Role:', :class => 'form_text_field_label'%></td>
        <td><%= f.select(:role, options_for_select([['Citizen', 'citizen'], ['Partner', 'partner'], ['Admin', 'admin']], selected: 'citizen'), {},  :style => "width: 240px;") %></td>
      </tr>
      <tr>
        <td align="right">Are you human?</td>
        <td><%= recaptcha_tags %></td>
      </tr>
      <tr>
        <td></td>
        <td><%= submit_tag 'Create user' %></td>
      </tr>
    </table>

    <p></p>
<% end -%>

<% end %>

